<?php


namespace app\service;


class BaseService
{
    protected static $service = [];

    /**
     * Method  instance
     *
     * @static
     * @return static
     */
    public static function instance() {

        if (isset(self::$service[static::class])) {
            return self::$service[static::class];
        } else {

            $obj = new static();
            self::$service[static::class] = $obj;
            return $obj;
        }
    }
}